package com.byedu.course.controller;

import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Luo on 2017-06-28.
 */
@Controller
@RequestMapping("/admin")
public class AdminIndexController {

    @RequestMapping("")
    public String defaultr(HttpServletRequest request) {
        String m = request.getParameter("m");
        if (StringUtils.isEmpty(m)) {
            m = "user";
        }
        request.setAttribute("m", m);
        request.setAttribute("newsnum", 100);
        request.setAttribute("clazznum", 20);
        request.setAttribute("sourcenum", 30);
        request.setAttribute("topicnum", 50);
        return "index";
    }

    @RequestMapping("/index")
    public String index(HttpServletRequest request) {
        String m = request.getParameter("m");
        if (StringUtils.isEmpty(m)) {
            m = "user";
        }
        request.setAttribute("m", m);
        request.setAttribute("newsnum", 100);
        request.setAttribute("clazznum", 20);
        request.setAttribute("sourcenum", 30);
        request.setAttribute("topicnum", 50);
        return "index";
    }

}
